<!DOCTYPE html>
<!--
To change this license header, choose License Headers in Project Properties.
To change this template file, choose Tools | Templates
and open the template in the editor.
-->

<div class="row">
    <div class="col-lg-12">
        <h3 class="page-header">Trả lời thông báo</h3>
    </div>
    <!-- /.col-lg-12 -->
</div>
<div class="row">
    <div class="col-lg-12">
        <div class="panel panel-default">
            <div class="panel-body">
                 <div class="row">
                    <div class="col-lg-9">                       
                    <!--<div class="col-lg-12">--> 
                       <div class="form-group"></div> 
                        <div class="col-lg-12"> 
                            <div class="row">
                             <div class="form-group">
                                   <a class="" href="<?php echo $this->url(array("action"=>"listanswer")) ?>">   <button type="reset" class="btn btn-default" id ="answer">Trở Về</button></a>
                               <!--         <a class="" href="<?php //echo $this->url(array("action"=>"listuser")) ?>">Gửi thông báo</a>-->
                                </div>   
                            </div>                            
                            <div class="row">
                            <div class="form-group" id="form_addquestion">
                               <form role="form" method="POST" name="addtFeedback" onsubmit="return checkinput();">
                                    <div class="form-group">
                                        <div class="row">
                                            <div class="col-lg-3">
<!--                                                <label>Tiêu đề:</label>-->
                                            </div>
                                            <div class="col-lg-6">
                                                 <input type ="hidden"  name="id" id="id" value="<?php echo $this->list_id?>" >
                                                 <!--<a class="" href="<?php //echo $this->url(array("action"=>"listanswer")) ?>">Xem danh sách câu trả lời</a></br>-->
                                                <a class="" href="<?php echo $this->url(array("action"=>"address")) ?>">Xem danh sách thông báo</a>
                                            </div>  
                                        </div>
                                    </div>
                                   <div class="form-group">
                                        <div class="row">
                                            <div class="col-lg-2">
                                                <label>Tiêu đề:</label>
                                            </div>
                                            <div class="col-lg-10">
                                                <input class="form-control" type ="text"  name="title"  id="title" disabled="disabled"value="<?php echo substr($this->getTitle, 3) ?>" >
                                            </div>  
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="row">
                                            <div class="col-lg-3">
                                                <label>Nội dung:</label>
                                            </div>
                                            <div class="col-lg-12">
                                                <textarea  name="question" id="question" type="text" class="form-control" disabled="disabled"><?php echo $this->getAnswer ?></textarea>    
                                            </div>  
                                        </div>
                                    </div>
                                    <div class="form-group">
                                        <div class="row">
                                            <div class="col-lg-3">
                                                <label>Trả lời</label>
                                            </div>
                                            <div class="col-lg-12">
                                                <textarea class="ckeditor" name="answer" id="answer"></textarea>                                   
                                            </div>
                                        </div>                                      
                                    </div>
                                    <div class="form-group"><center>
                                        <button type="submit" class="btn btn-default"id="submit">Trả lời</button>
                                        <button type="reset" class="btn btn-default" id="reset">Làm lại</button></center>
                                    </div>
                                </form>
                            </div>
                            </div> 
                            <!--</div>--> 
                    </div>
                            <div class="form-group">
                            <!-- --> 
                            <style>
/*                                #accordion section, #accordion .pointer, #accordion h1, #accordion p {
                                  -webkit-transition: all 0.5s ease-in-out;
                                  -moz-transition: all 0.5s ease-in-out;
                                  -ms-transition: all 0.5s ease-in-out;
                                  transition: all 0.5s ease-in-out;
                                }*/
                                #accordion {
                                  margin-bottom:30px;
                                }
                                #accordion h1 {
                                  line-height:1.2;
                                  font-size:20px;
                                  background-color:#ffffff;
                                  margin:0;
                                  padding: 10px 10px 10px 30px;
                                }
                                
                                #accordion h1 a {
                                  color:black;
                                }
                                #accordion section {
                                  overflow:hidden;
                                  height:220px;
                                  border:1px #333 solid;
                                }
                                #accordion p {
                                  padding:0 10px;
                                  color:black;
                                 
                                  
                                }
                                #accordion section.ac_hidden p:not(.pointer) {
                                  color:#fff;
                                }

                                #accordion section.ac_hidden {
                                  height:auto;
                                }
                                #accordion .pointer {
                                  padding:0;
                                  margin:10px 0 0 6px;
                                  line-height:20px;
                                  width:13px;
                                  position:absolute;
                                }
                                #accordion section:not(.ac_hidden) h1 {
                                  background-color:#c6e1ec;//mau khi ta click chuot
                                }

                                #accordion section:not(.ac_hidden) .pointer {
                                  display:block;
                                  -webkit-transform:rotate(90deg);
                                  -moz-transform:rotate(90deg);
                                  -o-transform:rotate(90deg);
                                  transform:rotate(90deg);
                                  padding:0;
                                  height: auto;
                                  width: auto;
                                }
                                </style>
                                <script>
                                $(document).ready(function() {
                                
                                    $("#accordion section h1").click(function(e) {
                                    $(this).parents().siblings("section").addClass("ac_hidden");
                                    $(this).parents("section").removeClass("ac_hidden");
                                   e.preventDefault();
                                  });
                                });
                                </script> 
                                </div>  
                        <!--</div>--> 
                         </div>
                     <div class="col-lg-3"> 
                             <div class="form-group">
                                 <h4><b>THÔNG TIN KHUYẾN MÃI</b></h4>
                            </div>  
                            <div class="form-group">                                
                            
                            <ul class="chat">
                            <?php
                    foreach ($this->items1 as $item) {
                        
                            if ($item->getEvent() == 1) {
                            ?>
                            <li class="left clearfix">
                                <span class="chat-img pull-left">
                                    <img src="<?php echo $this->ImageUrl() ?>/image/icon-hot.gif" alt="User Avatar" class="img-circle">
                                </span>
                                <div class="chat-body clearfix">
                                    <div class="header">
                                        <strong class="primary-font"><a href="#" id="pop-up" onclick="getNewsDetail('<?php echo $this->baseUrl() ?>/default/news/newsdetail',<?php echo $item->getId() ?>,'title','description','content')"><?php echo $item->getTitle() ?></a>
                                        
                                            </strong>
                                    </div>
                                    <small class="text-muted">
                                            <i class="fa fa-clock-o fa-fw"></i> <?php echo GlobalLib::viewDate($item->getCreated()) ?>
                                        </small>
                                    <p>
                                        <?php echo $item->getDescription() ?>
                                        <i class="pull-right"><i class=" fa fa-long-arrow-right"></i><a href="#" id="pop-up" onclick="getNewsDetail('<?php echo $this->baseUrl() ?>/default/news/newsdetail',<?php echo $item->getId() ?>,'title','description','content')">Đọc thêm</a></i>
                                    </p>
                                    
                                </div>
                            </li>
                    <?php } } ?> 
                                </ul>
                            </div>
                    </div>  
                     <!--ggg-->
                    </div>
            </div>
        </div>
    </div>   
</div>
<!-- modal -->
<div id="myModal" class="modal fade">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">
                        &times;</button>
                    <h4 class="modal-title">
                        <center>
                            <strong id="title"></strong>
                        </center>
                    </h4>
                </div>
                <div class="modal-body">    
                    <strong id="description"></strong><br>
                    <p id="content"></p>
                    
                </div>                    
            </div>
        </div>
    </div>
<script type="text/javascript">
   $('#myModal').modal('hide');
  function getNewsDetail(url,news_id,title_id,description,content_id){
    
    var params={
      news_id:news_id 
    };
    $.post(url,params,function(datas){
        $('#myModal').modal('show'); 
        
        var items=datas.split('[]');
        //alert(items[0]+"co du lieu");
        
        
        //alert(jItem.title);
        //exit();
        if(items[0]!=''){
            //alert("co");
           $('#title').html(items[0]);
           $('#description').html(items[1]);
           $('#content').html(items[2]);
        }
    });
}
</script>
<script type="text/javascript">
   document.forms['addtFeedback'].name.focus();
    function set_focus() {
        document.forms['addtFeedback'].name.focus();
    }
    function checkinput() {        
        var frm = window.document.addtFeedback;
        if(CKEDITOR.instances.answer.getData()==""){
            bootbox.alert("Vui lòng nhập nội dung câu trả lời");
            return false;
        }
               return true;
    }
</script>
<script type="text/javascript">
    $('#reset').click( function ( e ){	
        CKEDITOR.instances.answer.setData("");
    }); 
</script>
